﻿<navigation:Page 
    x:Class="PermDoc.PageList" 
    mc:Ignorable="d" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
    d:DesignWidth="1024"
    d:DesignHeight="800"
    VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
    Title="PageList Page" Loaded="Page_Loaded" Unloaded="Page_Unloaded" 
    MouseMove="LayoutRoot_MouseMove" KeyUp="Page_KeyUp" 
    MouseLeftButtonUp="Page_MouseLeftButtonUp" MouseRightButtonUp="Page_MouseRightButtonUp" 
    MouseWheel="Page_MouseWheel">

    <Grid 
        x:Name="LayoutRoot"
        Width="1024" Height="795"
        MinWidth="800" MinHeight="450"
        MaxWidth="2024" MaxHeight="550"
        VerticalAlignment="Top" HorizontalAlignment="Left" >

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="99*" />
            <ColumnDefinition Width="1*" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="500" MinHeight="450" MaxHeight="600" />
            <RowDefinition MinHeight="30" />
        </Grid.RowDefinitions>

        <sdk:DataGrid 
                x:Name="gv"
                Grid.Column="0" Grid.Row="0"
                IsReadOnly="True"
                SelectionMode="Single"
                AutoGenerateColumns="False"
                CanUserResizeColumns="False"
                Width="Auto" Height="470"
                MinWidth="800" MinHeight="400"
                MaxWidth="2024" MaxHeight="768"
                Visibility="Collapsed"
                VerticalAlignment="Top" HorizontalAlignment="Left"
                VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" 
                MouseLeftButtonUp="gv_MouseLeftButtonUp" MouseRightButtonUp="gv_MouseRightButtonUp" 
                MouseWheel="gv_MouseWheel" MouseMove="gv_MouseMove">

            <sdk:DataGrid.Columns>

                <sdk:DataGridTemplateColumn
                    Header="ИД" Width="50" Visibility="Collapsed">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <sdk:Label Content="{Binding ИД}"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

                <sdk:DataGridTemplateColumn
                    Header="" Width="40" Visibility="Visible">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <Button Name="oBtnInRow" ToolTipService.ToolTip="{Binding Tooltip}">
                                <Image 
                                    Height="12"
                                    Source="{Binding ImgUrl}" />
                            </Button>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

                <sdk:DataGridTemplateColumn
                    Header="No" Width="200" Visibility="Visible">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <sdk:Label 
                                Foreground="Brown"
                                Content="{Binding No}"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

                <sdk:DataGridTemplateColumn
                    Header="Статус" Width="80" Visibility="Visible">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <sdk:Label 
                                Content="{Binding Статус}"
                                Foreground="{Binding StatusColor}"
                                />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

                <sdk:DataGridTemplateColumn
                    Header="N_Док" Width="120" Visibility="Visible">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <sdk:Label 
                                Foreground="Brown"
                                Content="{Binding N_Док}"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

                <sdk:DataGridTemplateColumn
                    Header="Дата_Док" Width="60" Visibility="Visible">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <sdk:Label 
                                Foreground="DarkOliveGreen"
                                Content="{Binding Path=Дата_Док, Mode=OneWay, StringFormat='dd.MM.yy'}"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

                <sdk:DataGridTemplateColumn
                    Header="Магазин" Width="120" Visibility="Visible">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <sdk:Label
                                FontSize="10"
                                Foreground="DarkGray"
                                Content="{Binding Магазин}"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

                <sdk:DataGridTemplateColumn
                    Header="Контрагент" Width="120" Visibility="Visible">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <sdk:Label 
                                FontSize="10"
                                Foreground="DarkGray"
                                Content="{Binding Контрагент}"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

                <sdk:DataGridTemplateColumn
                    Header="Автор" Width="120" Visibility="Visible">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <sdk:Label 
                                FontSize="10"
                                Foreground="DarkGoldenrod"
                                Content="{Binding Автор}"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

                <sdk:DataGridTemplateColumn
                    Header="Создан" Width="120" Visibility="Visible">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <sdk:Label 
                                Foreground="DarkOliveGreen"
                                Content="{Binding Path=Создан, Mode=OneWay, StringFormat='dd.MM.yyyy hh:mm:ss'}"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

                <sdk:DataGridTemplateColumn
                    Header="Редактор" Width="120" Visibility="Visible">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <sdk:Label 
                                FontSize="10"
                                Foreground="DarkGoldenrod"
                                Content="{Binding Редактор}"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

                <sdk:DataGridTemplateColumn
                    Header="Изменён" Width="120" Visibility="Visible">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <sdk:Label 
                                Foreground="DarkOliveGreen"
                                Content="{Binding Path=Изменён, Mode=OneWay, StringFormat='dd.MM.yyyy hh:mm:ss'}"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

            </sdk:DataGrid.Columns>

            <sdk:DataGrid.RowGroupHeaderStyles>
                <!-- Style for groups at top level -->
                <Style TargetType="sdk:DataGridRowGroupHeader">
                    <Setter Property="PropertyNameVisibility" Value="Collapsed" />
                    <Setter Property="Background" Value="#FF112255" />
                    <Setter Property="Foreground" Value="#FFEEEEEE" />
                    <Setter Property="SublevelIndent" Value="15" />
                </Style>
                <!-- Style for groups under the top level -->
                <Style TargetType="sdk:DataGridRowGroupHeader">
                    <Setter Property="Background" Value="#44225566" />
                </Style>
            </sdk:DataGrid.RowGroupHeaderStyles>

            <sdk:DataGrid.RowDetailsTemplate>
                <!-- Begin row details section. -->
                <DataTemplate>
                    <Border BorderBrush="Black" BorderThickness="1" Background="Azure">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel>
                                <StackPanel Orientation="Vertical">

                                    <Grid>

                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition MinWidth="250" MaxWidth="300" Width="250" />
                                            <ColumnDefinition MinWidth="250" MaxWidth="300" Width="250" />
                                            <ColumnDefinition MinWidth="250" MaxWidth="300" Width="250" />
                                            <ColumnDefinition MinWidth="250" MaxWidth="300" Width="250" />
                                            <ColumnDefinition MinWidth="250" MaxWidth="300" Width="250" />
                                        </Grid.ColumnDefinitions>

                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="30" />
                                            <RowDefinition Height="30" />
                                            <RowDefinition Height="30" />
                                            <RowDefinition Height="30" />
                                            <RowDefinition Height="30" />
                                            <RowDefinition Height="30" />
                                            <RowDefinition Height="30" />
                                        </Grid.RowDefinitions>

                                        <!-- Controls are bound to SPUser properties. -->
                                        <TextBlock 
                                            Grid.Column="0" Grid.Row="0"
                                            FontSize="16" Foreground="MidnightBlue" 
                                            Text="Номер : "
                                            VerticalAlignment="Center" HorizontalAlignment="Right" />
                                        <TextBox 
                                            Grid.Column="1" Grid.Row="0" 
                                            FontSize="12" Foreground="MidnightBlue" FontWeight="Bold"
                                            Text="{Binding No}" 
                                            Width="240"
                                            IsReadOnly="True"
                                            Margin="0,0,10,0" 
                                            VerticalAlignment="Center" HorizontalAlignment="Left"/>

                                        <TextBlock 
                                            Grid.Column="2" Grid.Row="0"
                                            FontSize="12"
                                            Text="Дата документа : "
                                            VerticalAlignment="Center" HorizontalAlignment="Right" />
                                        <TextBox 
                                            Grid.Column="3" Grid.Row="0"
                                            FontSize="12"
                                            Text="{Binding Path=Дата_Док, Mode=OneWay, StringFormat='dd.MM.yyyy hh:mm:ss'}" 
                                            Width="240"
                                            IsReadOnly="True"
                                            VerticalAlignment="Center" HorizontalAlignment="Left"
                                            />

                                        <TextBlock 
                                            Grid.Column="2" Grid.Row="1"
                                            FontSize="12"
                                            Text="Создан на портале : "
                                            VerticalAlignment="Center" HorizontalAlignment="Right" />
                                        <TextBox 
                                            Grid.Column="3" Grid.Row="1"
                                            FontSize="12"
                                            Text="{Binding Path=Создан, Mode=OneWay, StringFormat='dd.MM.yyyy hh:mm:ss'}" 
                                            Width="240"
                                            IsReadOnly="True"
                                            VerticalAlignment="Center" HorizontalAlignment="Left"
                                            />

                                        <TextBlock 
                                            Grid.Column="2" Grid.Row="2"
                                            FontSize="12"
                                            Text="Автор : "
                                            VerticalAlignment="Center" HorizontalAlignment="Right" />
                                        <TextBox 
                                            Grid.Column="3" Grid.Row="2"
                                            FontSize="12"
                                            Text="{Binding Path=Автор}" 
                                            Width="240"
                                            IsReadOnly="True"
                                            VerticalAlignment="Center" HorizontalAlignment="Left"
                                            />

                                        <TextBlock 
                                            Grid.Column="2" Grid.Row="3"
                                            FontSize="12"
                                            Text="Изменен : "
                                            VerticalAlignment="Center" HorizontalAlignment="Right" />
                                        <TextBox 
                                            Grid.Column="3" Grid.Row="3"
                                            FontSize="12"
                                            Text="{Binding Path=Изменён, Mode=OneWay, StringFormat='dd.MM.yyyy hh:mm:ss'}" 
                                            Width="240"
                                            IsReadOnly="True"
                                            VerticalAlignment="Center" HorizontalAlignment="Left"
                                            />

                                        <TextBlock 
                                            Grid.Column="2" Grid.Row="4"
                                            FontSize="12"
                                            Text="Редактор : "
                                            VerticalAlignment="Center" HorizontalAlignment="Right" />
                                        <TextBox 
                                            Grid.Column="3" Grid.Row="4"
                                            FontSize="12"
                                            Text="{Binding Path=Редактор}" 
                                            Width="240"
                                            IsReadOnly="True"
                                            VerticalAlignment="Center" HorizontalAlignment="Left"
                                            />

                                        <TextBlock 
                                            Grid.Column="0" Grid.Row="1"
                                            FontSize="12"
                                            Text="Статус : "
                                            VerticalAlignment="Center" HorizontalAlignment="Right" />
                                        <TextBox 
                                            Grid.Column="1" Grid.Row="1"
                                            FontSize="12"
                                            Text="{Binding Path=Статус}" 
                                            Foreground="{Binding StatusColor}"
                                            Width="240"
                                            IsReadOnly="True"
                                            VerticalAlignment="Center" HorizontalAlignment="Left"
                                            />

                                        <TextBlock 
                                            Grid.Column="0" Grid.Row="2"
                                            FontSize="12"
                                            Text="Магазин : "
                                            VerticalAlignment="Center" HorizontalAlignment="Right" />
                                        <TextBox 
                                            Grid.Column="1" Grid.Row="2"
                                            FontSize="12"
                                            Text="{Binding Path=Магазин}" 
                                            Width="240"
                                            IsReadOnly="True"
                                            VerticalAlignment="Center" HorizontalAlignment="Left"
                                            />

                                        <TextBlock 
                                            Grid.Column="0" Grid.Row="3"
                                            FontSize="12"
                                            Text="Контрагент : "
                                            VerticalAlignment="Center" HorizontalAlignment="Right" />
                                        <TextBox 
                                            Grid.Column="1" Grid.Row="3"
                                            FontSize="12"
                                            Text="{Binding Path=Контрагент}" 
                                            Width="240"
                                            IsReadOnly="True"
                                            VerticalAlignment="Center" HorizontalAlignment="Left"
                                            />

                                        <TextBlock 
                                            Grid.Column="0" Grid.Row="4"
                                            FontSize="12"
                                            Text="Накладная : "
                                            VerticalAlignment="Center" HorizontalAlignment="Right" />
                                        <TextBox 
                                            Grid.Column="1" Grid.Row="4"
                                            FontSize="12"
                                            Text="{Binding Path=N_Док}" 
                                            Width="240"
                                            IsReadOnly="True"
                                            VerticalAlignment="Center" HorizontalAlignment="Left"
                                            />

                                        <ContentControl />

                                        <StackPanel 
                                                Grid.Column="1" Grid.Row="6" 
                                                Orientation="Horizontal" 
                                                HorizontalAlignment="Center"
                                                VerticalAlignment="Center"
                                            >

                                            <Button Click="Button_Click">
                                                Предварительный просмотр документов
                                            </Button>

                                        </StackPanel>

                                        <StackPanel 
                                                Grid.Column="2" Grid.Row="6"
                                                Grid.ColumnSpan="2"
                                                Orientation="Horizontal" 
                                                HorizontalAlignment="Center"
                                                VerticalAlignment="Center" >

                                            <HyperlinkButton 
                                                Content="{Binding Path=No, StringFormat=Открыть_в_браузере: \{0\}}"
                                                NavigateUri="{Binding Path=No, StringFormat=http://sp.korablik.local/shops/DocLib/\{0\}}" 
                                                TargetName="_blank" />

                                            <HyperlinkButton 
                                                Content="{Binding Path=ИД, StringFormat=Свойства}"
                                                NavigateUri="{Binding Path=ИД, StringFormat=http://sp.korablik.local/shops/DocLib/Forms/DispForm.aspx\?ID\=\{0\}}" 
                                                TargetName="_blank" />

                                        </StackPanel>

                                    </Grid>

                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </Border>
                </DataTemplate>
                <!-- End row details section. -->
            </sdk:DataGrid.RowDetailsTemplate>

        </sdk:DataGrid>

        <Grid 
            x:Name="LayoutBottom"
            Grid.Column="0" Grid.Row="1"
            Width="1024" 
            MinWidth="800" MinHeight="80"
            MaxWidth="2024" MaxHeight="150"
            Margin="0,-30"
            VerticalAlignment="Bottom" HorizontalAlignment="Left"
            >

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="20*" MinWidth="330" />
                <ColumnDefinition Width="20*" MinWidth="140" />
                <ColumnDefinition Width="30*" />
                <ColumnDefinition Width="30*" />
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition Height="1" MinHeight="0" MaxHeight="5" />
                <RowDefinition Height="35" MinHeight="30" MaxHeight="40" />
                <RowDefinition Height="35" MinHeight="30" MaxHeight="40" />
                <RowDefinition Height="35" MinHeight="30" MaxHeight="40" />
            </Grid.RowDefinitions>

            <StackPanel 
                Grid.Column="0" Grid.Row="0" 
                Orientation="Horizontal" 
                VerticalAlignment="Center" HorizontalAlignment="Left" >

            </StackPanel>

            <StackPanel 
                Grid.Column="0" Grid.Row="1" 
                Orientation="Horizontal" 
                VerticalAlignment="Center" HorizontalAlignment="Center" >
                <TextBlock 
                    Text="Все загруженные элементы" 
                    VerticalAlignment="Center" Foreground="DarkBlue" FontWeight="Bold" Height="Auto" FontSize="16">
                </TextBlock>
            </StackPanel>
            
            <StackPanel 
                Grid.Column="0" Grid.Row="2" 
                Orientation="Horizontal" 
                VerticalAlignment="Center" HorizontalAlignment="Left" >

                <TextBlock 
                    Text="   Поиск : " 
                    VerticalAlignment="Center" >
                </TextBlock>

                <TextBox 
                    Name="oFindText" Text="" 
                    Width="240"
                    BorderThickness="2" TextChanged="oFindText_TextChanged" >
                </TextBox>
            </StackPanel>

            <StackPanel 
                    Grid.Column="0" Grid.Row="3" 
                    Orientation="Horizontal" VerticalAlignment="Center">
                <Button Content="+" Margin="10,0,0,0" Click="Button_Click_Expand" />
                <Button Content=" - " Margin="5,0,0,0" Click="Button_Click_Collapse" />
            </StackPanel>

            <StackPanel 
                Grid.Column="1" Grid.Row="1" 
                Orientation="Horizontal" 
                VerticalAlignment="Center" HorizontalAlignment="Right">

                <CheckBox 
                    Name="oShopsCheck"
                    IsChecked="False"
                    VerticalAlignment="Center" HorizontalAlignment="Right" 
                    Checked="oShopsCheck_Checked" 
                    Unchecked="oShopsCheck_Unchecked">
                    Только магазин
                </CheckBox>

            </StackPanel>

            <StackPanel 
                Grid.Column="2" Grid.Row="1" 
                Orientation="Horizontal" 
                VerticalAlignment="Center" HorizontalAlignment="Left">

                <ComboBox 
                    Name="oShopsCombo"
                    MinWidth="200" Width="Auto"
                    Margin="20, 0"
                    VerticalAlignment="Center" HorizontalAlignment="Left" 
                    SelectedValuePath="Name" DisplayMemberPath="Name" 
                    SelectionChanged="oShopsCombo_SelectionChanged">

                </ComboBox>

            </StackPanel>

            <StackPanel 
                Grid.Column="1" Grid.Row="2" 
                Orientation="Horizontal" 
                VerticalAlignment="Center" HorizontalAlignment="Right">

                <CheckBox
                    Name="oCompanyCheck"
                    IsChecked="False"
                    VerticalAlignment="Center" HorizontalAlignment="Right" 
                    Checked="oCompanyCheck_Checked" 
                    Unchecked="oCompanyCheck_Unchecked">
                    Только контрагент
                </CheckBox>

            </StackPanel>

            <StackPanel 
                Grid.Column="2" Grid.Row="2" 
                Orientation="Horizontal" 
                VerticalAlignment="Center" HorizontalAlignment="Left">

                <ComboBox 
                    Name="oCompanyCombo"
                    MinWidth="200" Width="Auto"
                    Margin="20, 0"
                    VerticalAlignment="Center" HorizontalAlignment="Left"
                    SelectedValuePath="Name" DisplayMemberPath="Name" 
                    SelectionChanged="oCompanyCombo_SelectionChanged">

                </ComboBox>

            </StackPanel>

            <CheckBox 
                Content="Утвержден" 
                IsChecked="True"
                Name="oApprovedCheck"
                Grid.Column="3" Grid.Row="1" 
                Height="16" 
                HorizontalAlignment="Left" VerticalAlignment="Center" Checked="oApprovedCheck_Checked" Unchecked="oApprovedCheck_Unchecked">

            </CheckBox>

            <CheckBox 
                Name="oApprovedCheck2"
                Content="Черновик" 
                IsChecked="True"
                Grid.Column="3" Grid.Row="2" 
                Height="16" 
                HorizontalAlignment="Left" VerticalAlignment="Center" Checked="oApprovedCheck2_Checked" Unchecked="oApprovedCheck2_Unchecked" />

            <CheckBox 
                Content="Ожидает утверждения" 
                IsChecked="True"
                Name="oApprovedCheck3"
                Grid.Column="3" Grid.Row="3" 
                Height="16" 
                HorizontalAlignment="Left" VerticalAlignment="Center" Checked="oApprovedCheck3_Checked" Unchecked="oApprovedCheck3_Unchecked" />

        </Grid>

    </Grid>

</navigation:Page>
